<h1>Comics for this Week by Customer</h1>

<table border=1>
<th>Customer</th>
<th>Comics</th>
<th>Branch</th>

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db('comic_store', $con);
if (!$db_selected) {
	die ('Can\'t use root : ' . mysql_error());
}

$result = mysql_query("SELECT * FROM comic_reservations WHERE reservation_date='2011-11-11' ORDER BY user_id");
$result2 = mysql_query("SELECT * FROM users");

while ($row = mysql_fetch_assoc($result)) {
	echo "<tr>";
	echo "<td>";
	if($row['user_id']==1)
	echo "Test User";
	if($row['user_id']==2)
	echo "Juan";
	if($row['user_id']==3)
	echo "Michael";
	echo "</td>";
	echo "<td>";
	if($row['comic_id']==1)
	echo "Iron Man";
	if($row['comic_id']==2)
	echo "Flash";
	echo "</td>";
	echo "<td>";
	echo $row['branch_id'];
	echo "</td>";
	echo "</tr>";
}

mysql_close($con);
?>

</table>

<h1>Comics for this Week by Comic</h1>

<table border=1>
<th>Comics</th>
<th>Customer</th>
<th>Branch</th>

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db('comic_store', $con);
if (!$db_selected) {
	die ('Can\'t use root : ' . mysql_error());
}

$result = mysql_query("SELECT * FROM comic_reservations WHERE reservation_date='2011-11-11' ORDER BY comic_id");

while ($row = mysql_fetch_assoc($result)) {
	echo "<tr>";
	echo "<td>";
	if($row['comic_id']==1)
	echo "Iron Man";
	if($row['comic_id']==2)
	echo "Flash";
	echo "</td>";
	echo "<td>";
	if($row['user_id']==1)
	echo "Test User";
	if($row['user_id']==2)
	echo "Juan";
	if($row['user_id']==3)
	echo "Michael";
	echo "</td>";
	echo "<td>";
	echo $row['branch_id'];
	echo "</td>";
	echo "</tr>";
}

mysql_close($con);
?>

</table>

